package cn.xuchunh.campusbbs.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

/**
 * Created by XuChunH on 2015/9/12.
 */
public class DateUtil {

    public static final String FORMAT_YMD = "yyyy-MM-dd";

    public static String formatDate(Date date) {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(FORMAT_YMD, Locale.CHINA);
        return simpleDateFormat.format(date);
    }

    public static String formatDate(long time) {
        if(time <= 0){
            return "";
        }
        Date date = new Date(time);
        return formatDate(date);
    }


}
